package com.wits.qso.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 
 * @see 讨论组成员
 *
 */
@Entity
@Table(name="qso_discussion_member")
public class DiscussionMember implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2792086016747945472L;

	private DiscussionMemberPK id;
	
	/** 用户在讨论组的状态 **/
	private int status;
	
	private String userName;

	public DiscussionMember(){
		
	}


	public DiscussionMember(String groupId,String userId,int status){
		this.id=new DiscussionMemberPK(groupId, userId);
		this.status=status;
	}

	@EmbeddedId
	public DiscussionMemberPK getId() {
		return id;
	}

	public void setId(DiscussionMemberPK id) {
		this.id = id;
	}
	
	@Column(name="status")
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@Column(name="user_name",length=50)
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DiscussionMember other = (DiscussionMember) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "{userId:\"" + id.getUserId() + "\",userName:\"" + this.userName
				+"\",lineStatus:"+this.status+ "}";
	}
	
	
	
	
	
}
